import { IDataWithError } from '../../typing/service-typing'
import { IAuthService, ILoginData, ILoginParam, IRegisterData, IRegisterParam } from '../../typing/service/IAuthService'
import { HttpTransfer } from '../transfer/transfer'
import { IAuthURL } from '../transfer/urls/auth-url'

export class AuthService implements IAuthService {
  constructor(private readonly http: HttpTransfer, private readonly urls: IAuthURL) {}
  register(param: IRegisterParam): Promise<IDataWithError<IRegisterData, any>> {
    return this.http.request(this.urls.register, param)
  }
  login(param: ILoginParam): Promise<IDataWithError<ILoginData, any>> {
    return this.http.request(this.urls.loginMobileVerifyCode, param)
  }
}
